package com.ly.report_ah.util;

import org.springframework.stereotype.Component;

import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;

@Component
public class ConstatUtil {

    public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy年MM月dd日");

    public static final String RED_START = "</w:t></w:r> <w:r><w:rPr><w:color w:val=\"FF0000\"/></w:rPr><w:t>";
    public static final String RED_END = "</w:t></w:r><w:r><w:t>";


    public static final String UNDERLINE_START = "</w:t></w:r><w:r><w:rPr><w:u w:val=\"single\"/></w:rPr><w:t>";
    public static final String UNDERLINE_END = "</w:t></w:r><w:r><w:t>";
    /**
     * 单位序号获取市名
     * @param companyId
     * @return
     */
    public String getCityNameById(String companyId) {
        String compnayName = "";
        switch(companyId){
            case "1" :
                compnayName = "亳州";
                break;
            case "2" :
                compnayName = "池州";
                break;
            case "3":
                compnayName = "滁州";
                break;
            case "4":
                compnayName = "阜阳";
                break;
            case "5":
                compnayName = "黄山";
                break;
            case "6":
                compnayName = "铜陵";
                break;
            case "7":
                compnayName = "芜湖";
                break;
            case "8":
                compnayName = "合肥";
                break;
            case "9":
                compnayName = "蚌埠";
                break;
            case "10":
                compnayName = "六安";
                break;
            case "11":
                compnayName = "安庆";
                break;
            case "12":
                compnayName = "淮北";
                break;
            case "13":
                compnayName = "淮南";
                break;
            case "14":
                compnayName = "马鞍山";
                break;
            case "15":
                compnayName = "宿州";
                break;
            case "16":
                compnayName = "宣城";
                break;
        }
        return compnayName;
    }

    /**
     * @description 格式化时间为字符串
     * @author: GuoZheng
     * @create 2021-01-17 21:42
     */
    public static String formatDate(Date date){
        return DATE_TIME_FORMATTER.format(date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
    }

}
